package com.cykj.common.utils.date;


import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.util.Date;

public class DateUtil {

    /*
     * 获取当前网络时间(10位)
     */
    public static Date getBaiDuTime() {
        try {
            String webUrl="http://www.baidu.com";//百度时间
            URL url=new URL(webUrl);
            URLConnection conn=url.openConnection();
            conn.connect();
            long dateL=conn.getDate();
            Date date=new Date(dateL);
            return date;
        }catch (MalformedURLException e) {
            e.printStackTrace();
        }catch (IOException e) {
            e.printStackTrace();
        }
        return null;
    }



}
